//
//  ShowPressHud.m
//  iStar
//
//  Created by zking on 15/5/7.
//  Copyright (c) 2015年 com.zking. All rights reserved.
//

#import "ShowPressHud.h"
#import "MBProgressHUD.h"
@interface ShowPressHud(){
    
}

@end


@implementation ShowPressHud
static MBProgressHUD *progressHud;
static MBProgressHUD *progressHudLoading;


+(void) showPressHudLoading:(UIView *)view{
    progressHudLoading =[[MBProgressHUD alloc] init];
    progressHudLoading.labelText = @"加载中...";
    [view addSubview:progressHudLoading];
    [view bringSubviewToFront:progressHudLoading];
    [progressHudLoading show:YES];
}

+(void) removePressHud{
    [progressHudLoading removeFromSuperview];
    progressHudLoading = nil;
}


+(void)showPressHudView:(UIView *)view andText:(NSString *) text{
    progressHud = [[MBProgressHUD alloc] initWithView:view];
    [view addSubview:progressHud];
    progressHud.mode = MBProgressHUDModeCustomView;
    progressHud.labelText = text;
    [progressHud showAnimated:YES whileExecutingBlock:^{
        sleep(1.5);
    } completionBlock:^{
        [progressHud removeFromSuperview];
        progressHud = nil;
    }];

}

@end
